#ifndef ROBOT_H
#define ROBOT_H

#include <inttypes.h>
#include "packet.h"
#include "netcom.h"
#include "pms5005.h"
#include "pmb5010.h"

#define JPEG_BUF_SIZE 8192

typedef struct robot_data_s {
	uint16_t potentiometer[6];
	uint16_t encoder_count[2];
	uint16_t encoder_speed[2];	
	uint8_t encoder_dir[2];
	double motor_feedback[6];
	uint16_t custom_ad[8];
	uint8_t custom_io;
	uint8_t us_range[6];
	uint16_t human_alarm[2];
	uint16_t human_detect[2];
	uint16_t ir_range;
	uint16_t mainboard_pw;
	uint16_t dc_motor_pw;
	uint8_t jpeg[JPEG_BUF_SIZE];
	uint8_t jpeg_ready;
} robot_data_t;

status_t robot_data_set(packet_t *packet, robot_data_t *data);
packet_t *robot_rotate(robot_data_t *data, double deg);
packet_t *robot_move(robot_data_t *data, double dist);
packet_t *robot_rotate(robot_data_t *data, double degr);

#endif
